home *** CD-ROM | disk | FTP | other *** search
/ PC User 2002 August / Disc 1 / PCU0802CD1.iso / software / apps / files / 4teamol.exe / F10041_time.js < prev    next >
Encoding:
Text File  |  2001-12-09  |  7.5 KB  |  219 lines

  1. folderProjects = "Team Projects";
  2.  
  3. function GetTime() { 
  4. var dt = new Date();
  5. //var dt = tmpdate;
  6. var def = dt.getTimezoneOffset()/60;
  7. var gmt = (dt.getHours() + def);
  8. //document.clock.local.value = (IfZero(dt.getHours()) + ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds()));
  9. var ending = ":" + IfZero(dt.getMinutes()) + ":" +  IfZero(dt.getSeconds());
  10. var rome =check24(((gmt + 1) > 24) ? ((gmt + 1) - 24) : (gmt + 1));
  11. //document.clock.rome.value = (IfZero(rome) + ending);
  12. var isr =check24(((gmt + 2) > 24) ? ((gmt + 2) - 24) : (gmt + 2));
  13. //document.clock.Israel.value = (IfZero(isr) + ending);
  14. var msw =check24(((gmt + 3) > 24) ? ((gmt + 3) - 24) : (gmt + 3));
  15. //document.clock.msw.value = (IfZero(msw) + ending);
  16. var baku =check24(((gmt + 4) > 24) ? ((gmt + 4) - 24) : (gmt + 4));
  17. //document.clock.baku.value = (IfZero(baku) + ending);
  18. var del =check24(((gmt + 5) > 24) ? ((gmt + 5) - 24) : (gmt + 5));
  19. //document.clock.del.value = (IfZero(del) + ending);
  20. var dh =check24(((gmt + 6) > 24) ? ((gmt + 6) - 24) : (gmt + 6));
  21. //document.clock.dh.value = (IfZero(dh) + ending);
  22. var kok =check24(((gmt +7 ) > 24) ? ((gmt +7 ) - 24) : (gmt + 7));
  23. //document.clock.kok.value = (IfZero(kok) + ending);
  24. var ho =check24(((gmt + 8) > 24) ? ((gmt + 8) - 24) : (gmt + 8));
  25. //document.clock.ho.value = (IfZero(ho) + ending);
  26. var tky =check24(((gmt + 9) > 24) ? ((gmt + 9) - 24) : (gmt + 9));
  27. //document.clock.tky.value = (IfZero(tky) + ending);
  28. var sdn =check24(((gmt + 10) > 24) ? ((gmt + 10) - 24) : (gmt + 10));
  29. //document.clock.sdn.value = (IfZero(sdn) + ending);
  30. var mag =check24(((gmt + 11) > 24) ? ((gmt + 11) - 24) : (gmt + 11));
  31. //document.clock.mag.value = (IfZero(mag) + ending);
  32. var wll =check24(((gmt + 12) > 24) ? ((gmt + 12) - 24) : (gmt + 12));
  33. //document.clock.wll.value = (IfZero(wll) + ending);
  34.  
  35. var _GMT =check24(((gmt) > 24) ? ((gmt) - 24) : (gmt));
  36.  
  37. var eniw =check24(((gmt + (24-12)) > 24) ? ((gmt + (24-12)) - 24) : (gmt + (24-12)));
  38. //document.clock.eniw.value = (IfZero(eniw) + ending);
  39. var sam =check24(((gmt + (24-11)) > 24) ? ((gmt + (24-11)) - 24) : (gmt + (24-11)));
  40. //document.clock.sam.value = (IfZero(sam) + ending);
  41. var haw =check24(((gmt + (24-10)) > 24) ? ((gmt + (24-10)) - 24) : (gmt + (24-10)));
  42. //document.clock.Hawaii.value = (IfZero(haw) + ending);
  43. var ala =check24(((gmt + (24-9)) > 24) ? ((gmt + (24-9)) - 24) : (gmt + (24-9)));
  44. //document.clock.alaska.value = (IfZero(ala) + ending);
  45. var pacif =check24(((gmt + (24-8)) >= 24) ? ((gmt + (24-8)) - 24) : (gmt + (24-8)));
  46. //document.clock.pacif.value = (IfZero(pacif) + ending);
  47. var mount =check24(((gmt + (24-7)) > 24) ? ((gmt + (24-7)) - 24) : (gmt + (24-7)));
  48. //document.clock.mount.value = (IfZero(mount) + ending);
  49. var center =check24(((gmt + (24-6)) > 24) ? ((gmt + (24-6)) - 24) : (gmt + (24-6)));
  50. //document.clock.center.value = (IfZero(center) + ending);
  51. var east =check24(((gmt + (24-5)) > 24) ? ((gmt + (24-5)) - 24) : (gmt + (24-5)));
  52. //document.clock.east.value = (IfZero(east) + ending);
  53. var atl =check24(((gmt + (24-4)) > 24) ? ((gmt + (24-4)) - 24) : (gmt + (24-4)));
  54. //document.clock.atl.value = (IfZero(atl) + ending);
  55. var bra =check24(((gmt + (24-3)) > 24) ? ((gmt + (24-3)) - 24) : (gmt + (24-3)));
  56. bra = (bra >= 24) ? bra - 24 : bra;
  57. //document.clock.bra.value = (IfZero(bra) + ending);
  58. var mid =check24(((gmt + (24-2)) > 24) ? ((gmt + (24-2)) - 24) : (gmt + (24-2)));
  59. mid = (mid >= 24) ? mid - 24 : mid;
  60. //document.clock.mid.value = (IfZero(mid) + ending);
  61. var azo =check24(((gmt + (24-1)) > 24) ? ((gmt + (24-1)) - 24) : (gmt + (24-1)));
  62. azo = (azo >= 24) ? azo - 24 : azo;
  63. //document.clock.azo.value = (IfZero(azo) + ending);
  64. tz = Math.round(document.clock.SelectedTZ.value);
  65. if (tz == 0)
  66. {
  67.     document.clock.TZ.value = "Greenwich Mean Time (GMT)";
  68.     document.clock._GMT.value = (IfZero(_GMT) + ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds()));
  69. }
  70. if (tz == 1)
  71. {
  72.     document.clock.TZ.value = "Berlin, Rome (GMT+1)";
  73.     document.clock._GMT.value = (IfZero(rome) + ending);
  74. }
  75. if (tz == 2)
  76. {
  77.     document.clock.TZ.value = "Helsinki (GMT+2) ";
  78.     document.clock._GMT.value = (IfZero(isr) + ending);
  79. }
  80. if (tz == 3)
  81. {
  82.     document.clock.TZ.value = "Moscow (GMT+3) ";
  83.     document.clock._GMT.value = (IfZero(msw) + ending);
  84. }
  85. if (tz == 4)
  86. {
  87.     document.clock.TZ.value = "Baku (GMT+4) ";
  88.     document.clock._GMT.value = (IfZero(baku) + ending);
  89. }
  90. if (tz == 5)
  91. {
  92.     document.clock.TZ.value = "New Delhi (GMT+5) ";
  93.     document.clock._GMT.value = (IfZero(del) + ending);
  94. }
  95. if (tz == 6)
  96. {
  97.     document.clock.TZ.value = "Almaty, Dhaka (GMT+6) ";
  98.     document.clock._GMT.value = (IfZero(dh) + ending);
  99. }
  100. if (tz == 7)
  101. {
  102.     document.clock.TZ.value = "Bangkok (GMT+7) ";
  103.     document.clock._GMT.value = (IfZero(kok) + ending);
  104. }
  105. if (tz == 8)
  106. {
  107.     document.clock.TZ.value = "Hong Kong, Singapore (GMT+8) ";
  108.     document.clock._GMT.value = (IfZero(ho) + ending);
  109. }
  110. if (tz == 9)
  111. {
  112.     document.clock.TZ.value = "Tokyo, Seoul (GMT+9) ";
  113.     document.clock._GMT.value = (IfZero(tky) + ending);
  114. }
  115. if (tz == 10)
  116. {
  117.     document.clock.TZ.value = "Sydney, Vladivostok (GMT+10) ";
  118.     document.clock._GMT.value = (IfZero(sdn) + ending);
  119. }
  120. if (tz == 11)
  121. {
  122.     document.clock.TZ.value = "Magadan (GMT+11) ";
  123.     document.clock._GMT.value = (IfZero(mag) + ending);
  124. }
  125. if (tz == 12)
  126. {
  127.     document.clock.TZ.value = "Wellington (GMT+12) ";
  128.     document.clock._GMT.value = (IfZero(wll) + ending);
  129. }
  130. if (tz == 13)
  131. {
  132.     document.clock.TZ.value = "Eniwetok (GMT-12) ";
  133.     document.clock._GMT.value = (IfZero(eniw) + ending);
  134. }
  135. if (tz == 14)
  136. {
  137.     document.clock.TZ.value = "Midway Island, Samoa (GMT-11) ";
  138.     document.clock._GMT.value = (IfZero(sam) + ending);
  139. }
  140. if (tz == 15)
  141. {
  142.     document.clock.TZ.value = "Hawaii (GMT-10) ";
  143.     document.clock._GMT.value = (IfZero(haw) + ending);
  144. }
  145. if (tz == 16)
  146. {
  147.     document.clock.TZ.value = "Alaska (GMT-9) ";
  148.     document.clock._GMT.value = (IfZero(ala) + ending);
  149. }
  150. if (tz == 17)
  151. {
  152.     document.clock.TZ.value = "Pacific Time (GMT-8) ";
  153.     document.clock._GMT.value = (IfZero(pacif) + ending);
  154. }
  155. if (tz == 18)
  156. {
  157.     document.clock.TZ.value = "Mountain Time (GMT-7) ";
  158.     document.clock._GMT.value = (IfZero(mount) + ending);
  159. }
  160. if (tz == 19)
  161. {
  162.     document.clock.TZ.value = "Central Time (GMT-6) ";
  163.     document.clock._GMT.value = (IfZero(center) + ending);
  164. }
  165. if (tz == 20)
  166. {
  167.     document.clock.TZ.value = "Eastern Time (GMT-5) ";
  168.     document.clock._GMT.value = (IfZero(east) + ending);
  169. }
  170. if (tz == 21)
  171. {
  172.     document.clock.TZ.value = "Atlantic Time (GMT-4) ";
  173.     document.clock._GMT.value = (IfZero(atl) + ending);
  174. }
  175. if (tz == 22)
  176. {
  177.     document.clock.TZ.value = "Brazilia (GMT-3) ";
  178.     document.clock._GMT.value = (IfZero(bra) + ending);
  179. }
  180. if (tz == 23)
  181. {
  182.     document.clock.TZ.value = "Mid-Atlantic (GMT-2) ";
  183.     document.clock._GMT.value = (IfZero(mid) + ending);
  184. }
  185. if (tz == 24)
  186. {
  187.     document.clock.TZ.value = "Azores (GMT-1)";
  188.     document.clock._GMT.value = (IfZero(azo) + ending);
  189. }
  190.  
  191. setTimeout("GetTime()", 1000);
  192. }
  193.  
  194. function IfZero(num) {
  195. return ((num <= 9) ? ("0" + num) : num);
  196. }
  197.  
  198. function check24(hour) {
  199. return (hour >= 24) ? hour - 24 : hour;
  200. }
  201.  
  202. function ChangeTZ()
  203. {
  204.     if (document.clock.SelectedTZ.value > 23)
  205.     {
  206.         var newtz = 0;
  207.     }
  208.     else
  209.     {
  210.         var newtz = Math.round(document.clock.SelectedTZ.value) + 1;        
  211.     }
  212.     document.clock.SelectedTZ.value = newtz;
  213.     tOutApp = window.external.OutlookApplication;
  214.     tProjFolder = tOutApp.ActiveExplorer.CurrentFolder.Parent;
  215.     if (tProjFolder.name == folderProjects) tProjFolder = tOutApp.ActiveExplorer.CurrentFolder;
  216.     comadd.LocalTimePost(tProjFolder, newtz);
  217.     GetTime();
  218. }
  219.